package com.umeox.watch.moto.dataservice.db.dao;


import android.database.Cursor;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.ForbidPeriod;

import java.util.List;

@Dao
public interface ForbidPeriodDao {

    @Query("SELECT * FROM forbid_period")
    List<ForbidPeriod> queryAll();

    @Query("SELECT * FROM forbid_period WHERE deviceId=:deviceId")
    List<ForbidPeriod> query(String deviceId);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(ForbidPeriod forbidPeriod);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(List<ForbidPeriod> forbidPeriods);

    @Delete
    int delete(ForbidPeriod forbidPeriod);

    @Delete
    void delete(List<ForbidPeriod> forbidPeriods);

    @Query("DELETE FROM forbid_period")
    int deleteAll();

    @Query("SELECT * FROM forbid_period")
    Cursor query();
}
